import commonMutation from '../commonMutation';

// 模块状态管理
export default {
  namespaced: true,
  state: {
    isLogin: Boolean(localStorage.getItem('isLogin')) || false,
  },
  getters: {},
  //唯一修改state值的方法
  // commit
  mutations: {
    setLogin(state, data) {
      state.isLogin = data;
    },
    ...commonMutation
  },
  // 异步的操作
  // dispatch
  actions: {
    login({ commit }, data) {
      commit("setLogin", data);
    },
  },
};
